package com.yxw.blog.service;

import com.yxw.blog.bean.entity.User;
import com.yxw.blog.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpSession;

/**
 * @author yexinwei
 */
@Service
public class LoginService {
    @Autowired
    UserDao userDao;

    public User login(String name , String password , HttpSession session){
        User user = userDao.getUserByNameAndPassword(name, password);
        session.setAttribute("userId",user.getUserId());
        return user;
    }

}
